# coding=utf-8
##
## Author: jmdvirus@aliyun.com
##
## Create: Wed Jun 23 20:32:07 2021
##

import sys
import keras
import tensorflow as tf
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from tensorflow.keras.optimizers import RMSprop
import pandas as pd
import numpy as np

batch_size = 128
num_classes = 10
epochs = 10

oo = np.array([[4,5,6,1],[1,2,3,0],[1,8,2,0],[9,9,8,1],[1,2,4,0],[1,3,4,0],[4,5,2,0],[8,4,8,1],[7,6,8,1]])
oo = np.tile(oo, (10000, 1))

print(oo.shape)
a = pd.DataFrame(oo, columns=['a','b','c','d'])

print(a.shape)

b = a[['a','b','c']]
c = a[['d']]
print(b)

b = tf.convert_to_tensor(b)
print(a)

train_data = b[:6]
valid_data = b[6:]

c = tf.convert_to_tensor(c)
train_label = c[:6]
valid_label = c[6:]

print(train_data.shape)
print(valid_data.shape)
print(train_data)
print(valid_data)

model = Sequential()
model.add(Dense(512, activation='relu'))
model.add(Dropout(0.2))
model.add(Dense(512, activation='relu'))
model.add(Dropout(0.2))
model.add(Dense(1, activation='softmax'))
model.add(Dropout(0.2))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
model.fit(train_data, train_label, epochs=epochs, batch_size=batch_size, verbose=1, validation_data=(valid_data, valid_label))

o = model.predict([[3,5,2]])
print(o)

